layui.use(['laydate','form','table','layer','laytpl','common'], function(){
	var laydate = layui.laydate,form = layui.form,table = layui.table,layer = layui.layer,laytpl = layui.laytpl,common = layui.common;
	/*开始时间*/
	laydate.render({
	  	elem: '#start' //指定元素
	});
	/*结束时间*/
	laydate.render({
	  	elem: '#end' //指定元素
	});
	/*@条件*/
	var ids = $('input[name="ids"]').val()
	var type = $('input[name="type"]').val()
	var where = {ids: ids, type: type};
	/*@初始化table*/
	var tableObj = table.render({
	    elem: '#table-list',
	    url: '/staff/staff/rank', //数据接口
	    page: false, //开启分页
	    where: where,
	    limits: false,
	    cols: [[ //表头
	    	{field: 'id', title: '排名'},
	    	{field: 'admin_sn', title: '员工编号'},
	    	{field: 'nkname', title: '姓名'},
	    	{field: 'sex_text', title: '性别'},
	    	{field: 'phone', title: '联系方式'},
	    	{field: 'addtime', title: '入职日期'},
	    	{field: 'shop_name', title: '所属门店'},
	    	{field: 'g_title', title: '员工职位'},
	    	{field: 'order_num', title: '销售订单'},
	    	{field: 'goods_money', title: '销售总额(元)'},
	    	{field: 'profit_money', title: '销售总盈利(元)'},
	    	{field: 'profit_t_money', title: '盈利提成(元)'},
	    	{field: 'turnover_t_money', title: '营业额提成(元)'},
	    ]],
	    parseData: function(res){
	    	for(var i = 0;i < res.data.length;++i){
	    		res.data[i].id = i+1
	    	}
	    	exportData = res.data
	    },
	});
	/*@导出数据处理*/
	common.list.handleData = function(res){
		for(var i = 0;i < res.data.length;++i){
    		res.data[i].id = i + 1
    	}
    	return res.data
	}
	/*@查询*/
	common.list.search('search', tableObj)
	/*@导出*/
	common.list.excel('export', '/staff/staff/rank', tableObj, '员工销售排行榜', 'xls')
});